package me.xiaoyan.java.chapter15.shopping;

import java.util.Scanner;

public class User {
	
	private boolean login(String name, String password) {
		if (name.equalsIgnoreCase("admin") 
				&& password.equals("123456")) {
			return true;
		}

		return false;
	}
	
	/**
	 * 检查登录状态
	 * @return
	 */
	public boolean checkLoginInfo()
	{
		boolean result;
		do {
			Scanner input = new Scanner(System.in);
			System.out.print("请输入用户名:");
			String name = input.next();
			System.out.print("请输入密码:");
			String password = input.next();
			result = login(name, password);
			if(result){
				System.out.println("登录成功");
			}else{
				System.out.println("登录失败，请重新登录!");
			}
		} while (result == false);
		return true;
	}
	
	
}
